#!/bin/bash

if [ $# -lt 1 ];then
        echo "Usage:$0 level[1-8]"
        exit 1
fi

pid=`ps -ef | grep "./log" | grep -v "grep" | awk '{print $2}' `
level=`echo $1 > loglevel && cat loglevel`

if [ $pid != " " ];then
        kill -SIGUSR1 $pid
        echo -e "\e[1;32m set level $level\e[1;0m"
else
        echo -e "\e[1;35m log is not running \e[1;0m"
fi